#!/bin/sh

if [ "$ACTION" = "add" -a -e "$DEVNAME" ]; then
	if [ -x /usr/bin/logger ]; then
	    LOGGER=/usr/bin/logger
	elif [ -x /bin/logger ]; then
	    LOGGER=/bin/logger
	else
	    unset LOGGER
	fi
	#
	# for diagnostics
	#
	if [ -f /etc/udev/udev.conf ]; then
        	. /etc/udev/udev.conf
	fi


	if [ -t 1 -o -z "$LOGGER" ]; then
	    mesg () {
	        echo "$@"
	    }
	else
	    mesg () {
	        $LOGGER -t $(basename $0)"[$$]" "$@"
	    }
	fi

	debug_mesg () {
	    test -z "$UDEV_LOG" -o "$UDEV_LOG" != "1" && return
	    mesg "$@"
	}

	debug_mesg "/sbin/MAKEDEV ${DEVNAME#$udev_root}"
	/sbin/MAKEDEV "${DEVNAME#$udev_root}"
	debug_mesg "Restoring permissions for " $DEVNAME*
	/sbin/pam_console_apply $DEVNAME*
fi
